package net.xconcepts.stockdata.model.analysis.indicator;

import java.util.LinkedList;

public abstract class MovingAverageIndicator extends PeriodIndicator<Double, Double> {

	public MovingAverageIndicator(Indicator<Double, ?> baseIndicator,
			int numTicksInPeriod) {
		super(baseIndicator, numTicksInPeriod);
	}

	@Override
	protected Double calculateIndicator(LinkedList<Double> historicData) {
		double sum = 0;
		
		for(Double num : historicData) {
			sum = sum + num;
		}
		
		return sum / historicData.size();
	}

}
